package com.crayfish.quduo.utils;

import android.app.Activity;
import android.content.Context;
import android.os.Handler;
import android.util.Log;
import android.view.View;
import android.widget.Toast;

import com.crayfish.quduo.R;

//import cn.domob.android.ads.SplashAd;
//import cn.domob.android.ads.SplashAdListener;

/**
 * Created by crayfish on 2016/12/9.
 */
public class DomobUtil {

    private static String PublisherID = "56OJwVkYuNyo9eoou1";

    public interface SplashCallBack{
        void SplashAfter();
    }

//    public static void ShowSplash(final Activity activity, final View banner,final SplashCallBack splashCallBack){
////		缓存开屏广告
////		Cache splash ad
//        final SplashAd splashAd = new SplashAd(activity, PublisherID, "16TLu7zaApak2NUUnMBdIVYi",
//                SplashAd.SplashMode.SplashModeFullScreen);
////		setSplashTopMargin is available when you choose non-full-screen splash mode.
////	    splashAd.setSplashTopMargin(200);
//        splashAd.setSplashAdListener(new SplashAdListener() {
//            @Override
//            public void onSplashPresent() {
//                Log.i("DomobSDKDemo", "onSplashStart");
//            }
//
//            @Override
//            public void onSplashDismiss() {
//                Log.i("DomobSDKDemo", "onSplashClosed");
////				开屏回调被关闭时，立即进行界面跳转，从开屏界面到主界面。
////				When splash ad is closed, jump to the next(main) Activity immediately.
//                splashCallBack.SplashAfter();
////				如果应用没有单独的闪屏Activity，需要调用closeSplash方法去关闭开屏广告
////				If you do not carry a separate advertising activity, you need to call closeRTSplash way to close the splash ad
////				splashAd.closeSplash();
//            }
//
//            @Override
//            public void onSplashLoadFailed() {
//                Log.i("DomobSDKDemo", "onSplashLoadFailed");
//            }
//        });
//
//        new Handler().postDelayed(new Runnable() {
//            @Override
//            public void run() {
//                if (splashAd.isSplashAdReady()) {
//                    splashAd.splash(activity, banner);
//                } else {
//                    ToastUtil.show(R.string.no_net);
//                    splashCallBack.SplashAfter();
//                }
//            }
//        }, 1000);
//    }
}
